home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue51 / Observer / FMain.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1999-10-08  |  3.2 KB  |  133 lines

  1. {* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  2.   (c) TechInsite Pty. Ltd.
  3.   PO Box 429, Abbotsford, Melbourne. 3067 Australia
  4.   Phone: +61 3 9419 6456
  5.   Fax:   +61 3 9419 1682
  6.   Web:   www.techinsite.com.au
  7.   EMail: peter_hinrichsen@techinsite.com.au
  8.  
  9.   Created: October 1999
  10.  
  11.   Notes:   Main form for Observer Example
  12.  
  13. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
  14. unit FMain;
  15.  
  16. interface
  17.  
  18. uses
  19.   Windows, Messages, SysUtils, Classes, Graphics, Controls,
  20.   Forms, Dialogs, ComCtrls, ToolWin, ImgList, Menus,
  21.   ActnList;
  22.  
  23. type
  24.   TFormMain = class(TForm)
  25.     ToolBar1: TToolBar;
  26.     ToolButton1: TToolButton;
  27.     ToolButton2: TToolButton;
  28.     ToolButton3: TToolButton;
  29.     ToolButton4: TToolButton;
  30.     ToolButton5: TToolButton;
  31.     ImageList1: TImageList;
  32.     ActionList1: TActionList;
  33.     MainMenu1: TMainMenu;
  34.     aGrid: TAction;
  35.     aBarGraph: TAction;
  36.     aPieGraph: TAction;
  37.     aClose: TAction;
  38.     File1: TMenuItem;
  39.     N1: TMenuItem;
  40.     Grid1: TMenuItem;
  41.     BarGraph1: TMenuItem;
  42.     PieGraph1: TMenuItem;
  43.     Close1: TMenuItem;
  44.     Window1: TMenuItem;
  45.     Tile1: TMenuItem;
  46.     Cascade1: TMenuItem;
  47.     N2: TMenuItem;
  48.     Closeall1: TMenuItem;
  49.     procedure aGridExecute(Sender: TObject);
  50.     procedure aBarGraphExecute(Sender: TObject);
  51.     procedure aPieGraphExecute(Sender: TObject);
  52.     procedure aCloseExecute(Sender: TObject);
  53.     procedure Tile1Click(Sender: TObject);
  54.     procedure Cascade1Click(Sender: TObject);
  55.     procedure Closeall1Click(Sender: TObject);
  56.   private
  57.     { Private declarations }
  58.   public
  59.     { Public declarations }
  60.   end;
  61.  
  62. var
  63.   FormMain: TFormMain;
  64.  
  65. implementation
  66.  
  67. uses
  68.    Subject_Portfolio   // To give access to the gPortfolio
  69.   ,FObserver_Abstract
  70.   ,FObserver_Grid
  71.   ,FObserver_BarGraph
  72.   ,FObserver_PieGraph
  73.   ;
  74.  
  75. {$R *.DFM}
  76.  
  77. //----------------------------------------------------------
  78. procedure TFormMain.aGridExecute(Sender: TObject);
  79. var
  80.   lObserver : TFormObserverAbstract ;
  81. begin
  82.   lObserver := TFormObserverGrid.Create( Application ) ;
  83.   lObserver.Show ;
  84. end;
  85.  
  86. //----------------------------------------------------------
  87. procedure TFormMain.aBarGraphExecute(Sender: TObject);
  88. var
  89.   lObserver : TFormObserverAbstract ;
  90. begin
  91.   lObserver := TFormObserverBarGraph.Create( Application ) ;
  92.   lObserver.Show ;
  93. end;
  94.  
  95. //----------------------------------------------------------
  96. procedure TFormMain.aPieGraphExecute(Sender: TObject);
  97. var
  98.   lObserver : TFormObserverAbstract ;
  99. begin
  100.   lObserver := TFormObserverPieGraph.Create( Application ) ;
  101.   lObserver.Show ;
  102. end;
  103.  
  104. //----------------------------------------------------------
  105. procedure TFormMain.aCloseExecute(Sender: TObject);
  106. begin
  107.   Close ;
  108. end;
  109.  
  110. //----------------------------------------------------------
  111. procedure TFormMain.Tile1Click(Sender: TObject);
  112. begin
  113.   Tile ;
  114. end;
  115.  
  116. //----------------------------------------------------------
  117. procedure TFormMain.Cascade1Click(Sender: TObject);
  118. begin
  119.   Cascade ;
  120. end;
  121.  
  122. //----------------------------------------------------------
  123. procedure TFormMain.Closeall1Click(Sender: TObject);
  124. var
  125.   i : integer ;
  126. begin
  127.   for i := MDIChildCount - 1 downto 0 do
  128.     MDIChildren[i].Close ;
  129. end;
  130.  
  131. end.
  132.  
  133.